package team.bluepen.supermarket.web.base;

import team.bluepen.supermarket.data.dao.GoodRepository;
import team.bluepen.supermarket.data.dao.UserRepository;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Servlet基类
 * @author Kai
 */
public abstract class BaseServlet extends HttpServlet  {
    protected UserRepository userRepository;
    protected GoodRepository goodRepository;

    @Override
    public void init() throws ServletException {
        userRepository = new UserRepository();
        goodRepository = new GoodRepository();
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.sendRedirect("/");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    }


}
